#define Pyr 3 void setup() { pinMode(Pyr,INPUT); attachInterrupt(digitalPinToInterrupt(Pyr),detection,CHANGE); Serial.begin(9600); } void loop() { } void detection(){ if(digitalRead(Pyr)==HIGH){ Serial.println("Motion detect"); } else{ Serial.println("No Motion"); } }